class Parent:
    def my_print(self):
        pass

class CreateA(Parent):
    def my_print(self):
        print("This is CreateA")

class CreateB(Parent):
    def my_print(self):
        print("This is CreateB")

class Factory:
    def create(type: str) -> Parent:
        if type == "A":
            return CreateA()
        elif type == "B":
            return CreateB()
        else:
            raise ValueError("Invalid type")

a = Factory.create('A')
b = Factory.create('B')
a.my_print()
b.my_print()